package com.cgm.rsp.internal.resources;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import com.sun.jersey.api.view.Viewable;

// The Java class will be hosted at the URI path "/helloworld"
@Path("/helloworld")
public class HelloWorldResource {

	// The Java method will process HTTP GET requests
	@GET
	// The Java method will produce content identified by the MIME Media
	// type "text/plain"
	@Produces("text/plain")
	public String getClichedMessage() {
		// Return some cliched textual content
		return "Hello World";
	}
	
	
    @GET
    @Path("2")
    @Produces(MediaType.TEXT_HTML)
    public Viewable getAutoTemplate() {
        Map<String, String> map = new HashMap<String, String>();
        map.put("user", "Pavel");

        // template name  is derived from resource class name;
        // com.sun.jersey.samples.freemarker.resources.FreemarkerResource -> com/sun/jersey/samples/freemarker/resources/FreemarkerResource.ftl
        return new Viewable("/com/sun/jersey/samples/freemarker/resources/FreemarkerResource.ftl", map, HelloWorldResource.class);
    }
	
    @GET
    @Path("3")
    @Produces(MediaType.TEXT_HTML)
    public Viewable getAutoTemplate2() {
        Map<String, String> map = new HashMap<String, String>();
        map.put("user", "Pavel");

        
        return new Viewable("home", map);
    }
}